import {
	LoginViewActionType,
	ILoginViewAbility,
	ILoginViewControllerParams,
	ILoginViewModel,
	ILoginViewStore,
	IParam,
	IViewEvent,
} from '@/core';
import { QXEvent } from 'qx-util';
import {
	getViewClassNames,
	useViewAction,
	useViewBasic,
	useViewControllerParams,
	useViewProps,
} from '../use-view';

/**
 * 获取登录视图输入参数
 *
 * @export
 * @return {*}
 */
export function useLoginViewProps() {
	return {
		...useViewProps(),
	};
}

/**
 * 获取登录视图基础
 *
 * @export
 * @param {ILoginViewModel} model 登录视图模型
 * @param {IParam} props 输入参数
 * @return {*}
 */
export function useLoginViewBasic(model: ILoginViewModel, props: IParam) {
	const getClassNames = (props: IParam) => {
		return getViewClassNames(model, props);
	};
	return {
		...useViewBasic(model, props),
		getClassNames,
	};
}

/**
 * 登录视图行为
 *
 * @export
 */
export function useLoginViewAction(controller: any) {
	return {
		...useViewAction(controller),
	};
}

/**
 * 获取登录视图控制器输入参数
 *
 * @export
 * @param {ILoginViewModel} model
 * @param {IParam} props
 * @param {QXEvent<IViewEvent<LoginViewActionType, ILoginViewAbility>>} evt
 * @return {*}  {ILoginViewControllerParams<LoginViewActionType, ILoginViewAbility>}
 */
export function useLoginViewControllerParams(
	model: ILoginViewModel,
	props: IParam,
	evt: QXEvent<IViewEvent<LoginViewActionType, ILoginViewAbility>>
): ILoginViewControllerParams<LoginViewActionType, ILoginViewAbility> {
	return {
		...useViewControllerParams<ILoginViewStore, ILoginViewModel>(
			model,
			props,
			evt
		),
	};
}
